<script lang="ts">
import { defineComponent } from "vue";

export default defineComponent({
  props: {
    info: { type: Object, required: true },
  },
});
</script>

<template>
  <view class="comment-item">
    <view style="display: flex; align-items: center">
      <img class="comment-item-avatar" :src="info.head_img" />
      <view class="comment-item-name">{{ info.nickname }}</view>
      <view class="comment-item-date">{{ info.cdate }}</view>
    </view>
    <view class="comment-item-content">{{ info.content }}</view>
  </view>
</template>

<style lang="scss">
.comment-item {
  .comment-item-avatar {
    width: 56rpx;
    height: 56rpx;
    border-radius: 50%;
  }

  .comment-item-name {
    min-width: 0;
    margin-left: 16rpx;
    font-size: 30rpx;
    color: #333333;
    line-height: 44rpx;
    font-weight: bold;
    text-overflow: ellipsis;
    overflow: hidden;
  }

  .comment-item-date {
    margin-left: auto;
    font-size: 24rpx;
    color: #999999;
    line-height: 42rpx;
  }

  .comment-item-content {
    max-height: 100rpx;
    margin-top: 20rpx;
    font-size: 28rpx;
    color: #333333;
    line-height: 50rpx;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    text-overflow: ellipsis;
    overflow: hidden;
  }
}
</style>